import xml.etree.cElementTree as ET
        
class Test2():
    def load_level(self):
        tree = ET.ElementTree(file='doc1.xml')
            
        self.name = tree.find('name').text
        self.description = tree.find('description').text
        
        ship_list = list()
        shipgroup = tree.iterfind('ships/shipgroup')
        print( 'Ship List: ', shipgroup )
        for ship in shipgroup:
            time = int( ship.find('starttime').text )
            name = ship.find('name').text
            spawnpoint = ship.find('spawnpoint').text
            delay = int( ship.find('delay').text )
            count = int( ship.find('count').text )
            for i in range( count ):
                ship_list.append( {'time' : time+delay*i, 'name' : name, 'spawnpoint' : spawnpoint}  )

        ship_list.sort(key=lambda x:x['time'] )
        
        print( ship_list[1]['time'] )
            
    def print_data(self):
        print( 'Name: ', self.name )
        print( 'Description: ', self.description )
if __name__ == "__main__":
    MainTest = Test2()
    MainTest.load_level()
    MainTest.print_data()